set more off


*********************************************************************************************************************
***********************************************Figure S.3***************************************************************
*********************************************************************************************************************
local N=54648

local J = 10

set seed 400

do programs/flexiblelogit_point.do `J'  `N' 

gen r=.
save point.dta,replace




************************************************************************************************************
*************************Difference in beta/alpha_price absolute value, Figure S.3**************************** 
************************************************************************************************************
use bootstrap,clear
append using point

gen ratiodiff=abs(theoryrat)-abs(naivelogit) 

keep r ratiodiff*

gen ratiodiffhatt=ratiodiff if r==. 
egen ratiodiffhat=sum(ratiodiffhatt)
drop ratiodiffhatt 

*z0 

drop if r==.

gen low=(ratiodiff<=ratiodiffhat)
egen sumlow=sum(low)
gen z0=invnormal(sumlow/250)
gen p1=normal(z0+z0-invnormal(0.975))
gen p2=normal(z0+z0+invnormal(0.975))
_pctile ratiodiff, nq(1000)
local p1p=max(1,round(p1*1000))
local p2p=min(999,round(p2*1000))
gen lower=r(r`p1p')
gen upper=r(r`p2p')

keep ratiodiffhat lower upper 
keep if _n==1
rename (ratiodiffhat lower upper)(diffratio_point diffratio_lb diffratio_ub)
label var diffratio_point "point estimate of the difference between the absolute values of beta/alpha_price estimates from flexible logit and standard logit"
label var diffratio_lb "lower bound of confidence interval"
label var diffratio_ub "upper bound of confidence interval"

